import { Entity, PrimaryGeneratedColumn, Column, OneToMany } from 'typeorm';
import { TimeEntity } from '@/pmp/entity/base/time.entity';
import { PmpSysSubRoleEntity } from '@/pmp/entity/pmp.sys.sub.role.entity';
// 父角色表
@Entity('pmp-sys-role')
export class PmpSysRoleEntity extends TimeEntity {
  @PrimaryGeneratedColumn()
  id: bigint;

  @Column()
  role_name: string;

  @Column()
  role_key: string;

  @Column()
  description: string;

  @OneToMany(() => PmpSysSubRoleEntity, (subRole) => subRole.parent_id, {
    cascade: true,
  })
  children: PmpSysSubRoleEntity[]; // 与子角色的 OneToMany 关系
}
